package com.xnxkj.wx.micro.mch.utils;

public class StringUtils {
    private static final char[] NUMBER_ARRAY = "0123456789".toCharArray();
    private static final char[] CHAR_ARRAY = "abcdefghijklmnopqrstuvwxyz".toCharArray();
    public static String randomString(int len) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < len; i++) {
            if(Math.random() < 0.227){
                result.append(NUMBER_ARRAY[(int) (Math.random()*NUMBER_ARRAY.length)]);
            }else{
                result.append(CHAR_ARRAY[(int) (Math.random()*CHAR_ARRAY.length)]);
            }
        }
        return result.toString();
    }

    public static boolean isEmpty(String str) {
        return str == null || str.length() < 1;
    }
}
